<?php

define("DUMP_TYPE_UNKNOWN",		  1);
define("DUMP_TYPE_NULL",		  2);
define("DUMP_TYPE_BOOLEAN",		  4);
define("DUMP_TYPE_STRING",		  8);
define("DUMP_TYPE_INTEGER",		 16);
define("DUMP_TYPE_FLOAT",		 32);
define("DUMP_TYPE_ARRAY",		 64);
define("DUMP_TYPE_RESOURCE",	128);
define("DUMP_TYPE_OBJECT",		256);
define("DUMP_TYPE_FUNCTION",	512);

class Dump
{
	/**
	 * @todo __tostring()
	 * 
	 */
	
	protected $_variable;
	
	static public function getType($value)
	{
		if (!isset($value))
		{
			return DUMP_TYPE_NULL;
		}
		else if (is_bool($value))
		{
			return DUMP_TYPE_BOOLEAN;
		}
		else if (is_string($value))
		{
			return DUMP_TYPE_STRING;
		}
		else if (is_integer($value))
		{
			return DUMP_TYPE_INTEGER;
		}
		else if (is_float($value))
		{
			return DUMP_TYPE_FLOAT;
		}
		else if (is_array($value))
		{
			return DUMP_TYPE_ARRAY;
		}
		else if (is_resource($value))
		{
			return DUMP_TYPE_RESOURCE;
		}
		else if (is_object($value))
		{
			return DUMP_TYPE_OBJECT;
		}
		else if (function_exists($value))
		{
			return DUMP_TYPE_FUNCTION;
		}
		return DUMP_TYPE_UNKNOWN;
	}
	
	static public function getTypeAll($value)
	{
		$type = 0x00;
		switch (Dump::getType($value))
		{
			case DUMP_TYPE_ARRAY:
				
				$type = DUMP_TYPE_ARRAY;
				foreach ($value as $item)
				{
					$type |= Dump::getType($item); 
				}
				
				break;
			
			default:
				$type = Dump::getType($value);
		}
		return $type;
	}
	
	/**
	 * @todo C110320 Dump::describeValue
	function describeValue($variable, $detail = false)
	{
		switch ($variable)
		{
			case DUMP_TYPE_ARRAY:
				return "Array: " . count($variable) . " entries";
			case DUMP_TYPE_BOOLEAN:
				return "Boolean: " . ($variable? "true": "false");
			case DUMP_TYPE_FLOAT:
				return "Float: " . ($detail? $variable:
				                             sprintf("%10.3s", $variable));
			case DUMP_TYPE_INTEGER:
				return "Integer: " . $variable;
			case DUMP_TYPE_NULL:
				return "NULL";
			case DUMP_TYPE_OBJECT:
				return "Object: " . 
		}
	}
	*/
}